---
title: JSON:API Params
excerpt: How to use Drupal JSON-API Params to query and filter resources.
---

next-drupal has support for [Drupal JSON:API Params](https://github.com/d34dman/drupal-jsonapi-params), a helper for building query params.

You use query params for filtering, sorting and paginating resources returned by JSON:API.

---

## Installation

```
yarn add drupal-jsonapi-params
```

## Usage

```tsx
import { DrupalNode } from "next-drupal"
import { DrupalJsonApiParams } from "drupal-jsonapi-params"

export default async function ArticlePage() {
  // highlight-start
  const params = new DrupalJsonApiParams()
    .addFields("node--article", ["title", "path", "body", "uid"])
    .addFilter("status", "1")
    .addInclude(["uid.user_picture"])
    .addSort("created", "DESC")
  // highlight-end

  const article = await drupal.getResourceCollection<DrupalNode[]>(
    "node--article",
    {
      params: params.getQueryObject(), // highlight-line
    }
  )
}
```

You can read more about Drupal JSON:API Params [here](https://github.com/d34dman/drupal-jsonapi-params).
